# helloworld_syscall_gcc.s
.section .data
.section .text
msg:
    .string "hello world\n"

.globl main

main:
    # printf("hello world\n")
    mov     $0, %rax        # 必须将eax置零才能成功 call printf ?
    mov     $msg, %rdi
    call    printf

    # exit(0)
     mov     $0, %rdi    
     call    exit


# to run this file, follow the commands below
# $ gcc -no-pie helloworld_syscall_gcc.s
# $ ./a.out
# Hello World!
